
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    a{
        color:blue;
    }
</style>
<body>
<form class="form-inline">
    <div class="form-group">
        <label for="exampleInputName2">输入搜索:</label>
        <input type="text" class="form-control" id="exampleInputName2" placeholder="商品名称/关键字">
    </div>
    <label for="exampleInputName2">商品分类:</label>
    <select class="form-control" id="category">
    </select>
    <label for="exampleInputName2">上架状态:</label>
    <select class="form-control" id="state" >
        <option value="1">上架</option>
        <option value="0">下架</option>
    </select>
    <button type="submit" class="btn btn-default" id="search">查询</button>
</form>

<table class="table table-hover" id="table">
    <tr class="tab_head">
        <th><input type="checkbox" name="like" value="0"></th>
        <th>编号</th>
        <th>图片</th>
        <th>名称</th>
        <th>颜色</th>
        <th>价格</th>
        <th>库存</th>
        <th>销量</th>
        <th>状态</th>
        <th>操作</th>
    </tr>

</table>
<tr>
    <td colspan="8">
        <div class="pagelist" style="background: #01AAED">
            <a href="../entry.do?method=list&p=${pagination.pageNumber-1>0?(pagination.pageNumber-1):1}">上一页</a>
                    <c:forEach items="${pagination.navigatePageNumbers}" var="index">
                        <c:choose>
                            <c:when test="${index==pagination.pageNumber}">
                                <span class="current">${index}</span>
                            </c:when>
                            <c:otherwise>
                                <a href="entry.do?&p=${index}">${index}</a>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>
            <a href="../entry.do?&p=${pagination.pageNumber+1<=pagination.pages?(pagination.pageNumber+1):pagination.pages}">下一页</a>
            <a href="../entry.do?method=list&p=${pagination.pages}">尾页</a>
        </div>
    </td>
</tr>
</body>
<script>
    $(document).ready(function() {
        //默认执行的方法
        listGoods();
        listCategory();

        $("#search").click(function (event) {
            //取消事件默认行为
            event.preventDefault();

            var keyword = $("#exampleInputName2").val();
            var category = $("#category").val();
            var state = $("#state").val();
            // alert(keyword);
            // alert(category);
            alert(state);
            searchGoods(keyword,category,state);
        });

    });

</script>
</html>
